package cn.edu.hunau.java.week02.day02.afternoon;

import sun.java2d.loops.ProcessPath;

public class Rectangle extends Shape {
    private int width;
    private int height;

    public Rectangle(){

    }

    public Rectangle(Point position,int width,int height){
        super(position);
        this.width = width;
        this.height = height;
    }

    @Override
    public double area() {
        return this.width * this.height;
    }

    @Override
    public boolean container(Point p) {
        return p.x >= this.getPosition().x && p.x <= this.getPosition().x + this.width && p.y >= this.getPosition().y && p.y <= this.getPosition().y + this.height;
    }

    public Rectangle(int x,int y,int width,int height){
        super(x,y);
        this.width = width;
        this.height = height;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }
}
